﻿namespace JuCheap.Service.Model
{
    #region 过滤器

    /// <summary>
    /// 过滤器连接类型
    /// </summary>
    public enum LinkType
    {
        /// <summary>
        /// 等于
        /// </summary>
        Equal = 1,
        /// <summary>
        /// 小于
        /// </summary>
        LessThan = 2,
        /// <summary>
        /// 小于等于
        /// </summary>
        LessEqualThan = 3,
        /// <summary>
        /// 大于
        /// </summary>
        GraterThan = 4,
        /// <summary>
        /// 大于等于
        /// </summary>
        GraterEqualThan = 5,
        /// <summary>
        /// Like
        /// </summary>
        Like = 6,

        /// <summary>
        /// StartsWith
        /// </summary>
        StartsWith = 7,

        /// <summary>
        /// EndsWith
        /// </summary>
        EndsWith = 8,

        /// <summary>
        /// Contains
        /// </summary>
        Contains = 9
    }

    /// <summary>
    /// 条件
    /// </summary>
    public enum ConditionType
    {
        And = 1,
        Or = 2,
        AndAlso = 3
    }

    /// <summary>
    /// 过滤器
    /// </summary>
    public class QueryFilter
    {
        /// <summary>
        /// 过滤的关键字
        /// </summary>
        public string Key { get; set; }

        /// <summary>
        /// 过滤的值 
        /// </summary>
        public object Value { get; set; }

        /// <summary>
        /// And Or AndAlso
        /// </summary>
        public ConditionType Condition { get; set; }

        /// <summary>
        /// 过滤的约束 比如：'小于' '小于登录' '大于' '大于等于' 'like'等 
        /// </summary>
        public LinkType Contract { get; set; }
    }

    #endregion
}
